package com.stox.shared.indicator.manager;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import com.stox.shared.indicator.model.intf.Indicator;

@Component
public class IndicatorManager implements InitializingBean {

	@Autowired
	private ApplicationContext applicationContext;
	private final List<Indicator<?, ?>> indicators = new ArrayList<Indicator<?, ?>>();

	@Override
	@SuppressWarnings("unchecked")
	public void afterPropertiesSet() throws Exception {
		indicators.addAll((Collection<? extends Indicator<?, ?>>) applicationContext.getBeansOfType(Indicator.class).values());
	}

	public List<Indicator<?, ?>> findAll() {
		return indicators;
	}

}
